package frmsystem.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SpringLayout;

import frmsystem.Domain;

public class OperationPanel extends JPanel {
	
	//SpringLayout layout = new SpringLayout();
	protected FlowLayout layout = new FlowLayout();
	protected JButton btnAddPersonalAccount;
	protected JButton btnAddCompanyAccount;
	protected JButton btnAddInterest;
	
	public OperationPanel(){
	}

	public OperationPanel(int width, int height){
		super();
		setLayout(layout);
		btnAddPersonalAccount = new JButton("Add Personal Account");
		add(btnAddPersonalAccount);
		/*layout.putConstraint(SpringLayout.WEST, btnAddPersonalAccount, 10, SpringLayout.WEST, this);
		layout.putConstraint(SpringLayout.NORTH, btnAddPersonalAccount, 10, SpringLayout.NORTH, this);*/
		
		btnAddCompanyAccount = new JButton("Add Company Account");
		add(btnAddCompanyAccount);
		/*layout.putConstraint(SpringLayout.WEST, btnAddCompanyAccount, 10, SpringLayout.EAST, btnAddPersonalAccount);
		layout.putConstraint(SpringLayout.NORTH, btnAddCompanyAccount, 0, SpringLayout.NORTH, btnAddPersonalAccount);*/
		
		btnAddInterest = new JButton("Add Interest");
		add(btnAddInterest);
		/*layout.putConstraint(SpringLayout.WEST, btnAddInterest, 10, SpringLayout.EAST, btnAddCompanyAccount);
		layout.putConstraint(SpringLayout.NORTH, btnAddInterest, 0, SpringLayout.NORTH, btnAddCompanyAccount);*/
		
		setSize(new Dimension(width, height));
		
	}
	
	//TEST main
	public static void main(String ar[]){
		JFrame frm = new JFrame();
		frm.getContentPane().setLayout(new GridLayout());
		frm.getContentPane().add(new OperationPanel(500, 100));
		frm.setSize(new Dimension(500, 100));
		frm.setVisible(true);
	}
	
	public void setAddPersonalAccountListener(ActionListener al){
		this.btnAddPersonalAccount.addActionListener(al);
	}
	
	public void setAddCompanyAccountListener(ActionListener al){
		this.btnAddCompanyAccount.addActionListener(al);
	}
	
	public void setAddInterestListener(ActionListener al){
		this.btnAddInterest.addActionListener(al);
	}
}
